package com.zeta.api.client.demo;

import cn.hutool.core.map.MapUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * KotlinDemo服务 Feign接口降级处理
 *
 * @author gcc
 */
@Slf4j
@Component
public class IDemoKotlinApiFallbackFactory implements FallbackFactory<IDemoKotlinApi> {

    @Override
    public IDemoKotlinApi create(Throwable cause) {
        log.error("KotlinDemo服务 feign接口调用失败: {}", cause.getMessage());
        return new IDemoKotlinApi() {
            @Override
            public Map<String, Object> health() {
                return MapUtil.empty();
            }
        };
    }
}
